package com.sagframe.sagacity.sqltoy.plus.multi.query;

import com.sagframe.sagacity.sqltoy.plus.conditions.eumn.SqlKeyword;
import com.sagframe.sagacity.sqltoy.plus.multi.AbstractLambdaMultiWrapper;
import com.sagframe.sagacity.sqltoy.plus.multi.MultiContext;
import com.sagframe.sagacity.sqltoy.plus.multi.LambdaMultiStepWrapper;
import com.sagframe.sagacity.sqltoy.plus.multi.model.LambdaColumn;

public class LambdaMultiQueryWrapper<T> extends AbstractLambdaMultiWrapper<LambdaMultiQueryWrapper<T>> implements LambdaQuery<LambdaMultiQueryWrapper<T>, LambdaColumn> {

    public LambdaMultiQueryWrapper(Class<T> toClass) {
        super(toClass);
        context.addOperateSqlSegment(SqlKeyword.SELECT);
    }

    public LambdaMultiQueryWrapper(MultiContext context) {
        super(context);
    }

    @Override
    public LambdaMultiStepWrapper.LambdaFrom<LambdaMultiQueryWrapper<T>> select(LambdaColumn... columns) {
        context.addSelectSqlAssembler(columns);
        return new LambdaMultiStepWrapper.MultiStepWrapperBuilder<>(typedThis, context);
    }

    @Override
    public LambdaMultiStepWrapper.LambdaFrom<LambdaMultiQueryWrapper<T>> select(Class<?> mappingClass, LambdaColumn... lambdaColumns) {
        context.addSelectSqlAssembler(mappingClass, lambdaColumns);
        return new LambdaMultiStepWrapper.MultiStepWrapperBuilder<>(typedThis, context);
    }

    @Override
    protected LambdaMultiQueryWrapper<T> instance() {
        return new LambdaMultiQueryWrapper<>(context);
    }
}
